package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.dao.PersonDao;
import com.example.entity.Person;
import com.example.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class PersonServiceImpl implements PersonService {

    @Autowired
    private PersonDao personDao;

    @Override
    public Page<Person> findPage(Page<Person> page1, QueryWrapper<Person> queryWrapper) {
        return personDao.selectPage(page1,queryWrapper);
    }

    @Override
    public void add(Person person){
        personDao.insert(person);
    }

    @Override
    public Person findById(int id) {

        return personDao.findById(id);
    }

    @Override
    public void update(Person person) {
        personDao.updatePerson(person);
    }

    @Override
    public void del(int id) {
        personDao.deleteById(id);
    }


//    @Override
//    public Page<Person> findPage(Page<Person> page1) {
//        return personDao.selectPage(page1,null);
//    }


}
